/*
 * Copyright (c)$today.year.month.day
 *  admin:郑程荣.
 *  文件名:Practice2DrawCircleView.java
 *  项目功能:
 */

package zcr.com.customview.practice;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by llz on 2018/11/22.
 */
public class Practice2DrawCircleView extends View {
    public Practice2DrawCircleView(Context context) {
        super(context);
    }

    public Practice2DrawCircleView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public Practice2DrawCircleView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint mPaint = new Paint();
        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.FILL);
        // cx,cy指的是x轴\y轴距离圆心的距离
        canvas.drawCircle(300,150,150,mPaint);

        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(10);//设置线条宽度
        // cx,cy指的是x轴\y轴距离圆心的距离
        canvas.drawCircle(700,160,150,mPaint);

        //在绘制的时候，往往需要开启抗锯齿来让图形和文字的边缘更加平滑
         mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setColor(Color.BLUE);
        mPaint.setStyle(Paint.Style.FILL);
        // cx,cy指的是x轴\y轴距离圆心的距离
        canvas.drawCircle(300,560,150,mPaint);

        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(60);//设置线条宽度
        // cx,cy指的是x轴\y轴距离圆心的距离
        canvas.drawCircle(700,560,150,mPaint);


    }
}
